action.connect('pan', this._onPan.bind(this));
this._scrollView.add_action(action);
+ this._appIds = [];
this._redisplay();
}
}
_getItemPosition(item) {
- const appIds = this._getFolderApps();
- const appIndex = appIds.indexOf(item.id);
+ const appIndex = this._appIds.indexOf(item.id);
if (appIndex === -1)
return [-1, -1];
}
_compareItems(a, b) {
- const appIds = this._getFolderApps();
-
- const aPosition = appIds.indexOf(a.id);
- const bPosition = appIds.indexOf(b.id);
+ const aPosition = this._appIds.indexOf(a.id);
+ const bPosition = this._appIds.indexOf(b.id);
if (aPosition === -1 && bPosition === -1)
return a.name.localeCompare(b.name);
_loadApps() {
let apps = [];
let appSys = Shell.AppSystem.get_default();
- const appIds = this._getFolderApps();
- appIds.forEach(appId => {
+ this._appIds.forEach(appId => {
const app = appSys.lookup_app(appId);
let icon = this._items.get(appId);
return apps;
}
+ _redisplay() {
+ // Keep the app ids list cached
+ this._appIds = this._getFolderApps();
+
+ super._redisplay();
+ }
+
acceptDrop(source) {
if (!super.acceptDrop(source))
return false;